struct pdb_record *pdb_rec;
if (NULL == (pdb = pdb_Read(fileno(file_in)))) {
- fatal(MYNAME ": pdb_Read failed");
+ fatal(MYNAME ": pdb_Read failed\n");
}
if ((pdb->creator != MYCREATOR) || (pdb->type != MYTYPE)) {
- fatal(MYNAME ": Not a Cetus file.");
+ fatal(MYNAME ": Not a Cetus file.\n");
}
for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) {
opdb_rec = new_Record (0, 0, ct++, sizeof(*rec), (const ubyte *)rec);
if (opdb_rec == NULL) {
- fatal(MYNAME ": libpdb couldn't create record");
+ fatal(MYNAME ": libpdb couldn't create record\n");
}
if (pdb_AppendRecord(opdb, opdb_rec)) {
- fatal(MYNAME ": libpdb couldn't append record");
+ fatal(MYNAME ": libpdb couldn't append record\n");
}
}
typedef void (*ff_read) (void);
typedef void (*ff_write) (void);
+void fprintdms(FILE *, const coord *, int);
+
typedef void (*waypt_cb) (const waypoint *);
void waypt_add (waypoint *);
void waypt_del (waypoint *);
-void route_add (waypoint *);
void waypt_disp_all(waypt_cb);
unsigned int waypt_count(void);
-void fprintdms(FILE *, const coord *, int);
+
+route_head *route_head_alloc(void);
+void route_add (waypoint *);
+void route_add_wpt(route_head *rte, waypoint *wpt);
+void route_add_head(route_head *rte);
+
char *mkshort (const char *);
void setshort_length(int n);
void setshort_badchars(const char *);
void setshort_mustupper(int n);
+void setshort_whitespace_ok(int n);
typedef struct ff_vecs {
ff_init rd_init;
void waypt_init(void);
void route_init(void);
void waypt_disp(const waypoint *);
-void fatal(const char *, ...);
+void fatal(const char *, ...)
+#if __GNUC__
+ __attribute__ ((__format__ (__printf__, 1, 2)));
+#endif
+ ;
ff_vecs_t *find_vec(char *);
void disp_vecs(void);
void printposn(const coord *c, int is_lat);
{
fd = fopen(fname, "r");
if (fd == NULL) {
- fatal(MYNAME ":Can not open %s for reading\n");
+ fatal(MYNAME ":Cannot open %s for reading\n", fname);
}
psr = XML_ParserCreate(NULL);
if (!psr) {
- fatal(MYNAME ":Can not create XML parser\n");
+ fatal(MYNAME ":Cannot create XML parser\n");
}
XML_SetElementHandler(psr, geo_start, geo_end);
{
ofd = fopen(fname, "w");
if (ofd == NULL) {
- fatal(MYNAME ":Can not open %s for writing\n");
+ fatal(MYNAME ":Cannot open '%s' for writing\n", fname);
}
}
struct pdb_record *pdb_rec;
if (NULL == (pdb = pdb_Read(fileno(file_in)))) {
- fatal(MYNAME ": pdb_Read failed");
+ fatal(MYNAME ": pdb_Read failed\n");
}
if ((pdb->creator != MYCREATOR) || (pdb->type != MYTYPE)) {
- fatal(MYNAME ": Not a gpspilot file.");
+ fatal(MYNAME ": Not a gpspilot file.\n");
}
for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) {
opdb_rec = new_Record (0, 2, ct++, vdata-(char *)rec, (const ubyte *)rec);
if (opdb_rec == NULL) {
- fatal(MYNAME ": libpdb couldn't create record");
+ fatal(MYNAME ": libpdb couldn't create record\n");
}
if (pdb_AppendRecord(opdb, opdb_rec)) {
- fatal(MYNAME ": libpdb couldn't append record");
+ fatal(MYNAME ": libpdb couldn't append record\n");
}
}
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,GetLastError(),0,
(LPTSTR) &buf,0,NULL);
- fatal(MYNAME ": '%s' cannot be opened. %s", portname, buf);
+ fatal(MYNAME ": '%s' cannot be opened. %s\n", portname, buf);
}
tio.DCBlength = sizeof(DCB);
GetCommState (comport, &tio);
if (!SetCommState (comport, &tio)) {
CloseHandle(comport);
- fatal(MYNAME ": set port settings");
+ fatal(MYNAME ": set port settings\n");
}
GetCommTimeouts (comport, &timeout);
timeout.WriteTotalTimeoutConstant = 1000;
if (!SetCommTimeouts (comport, &timeout)) {
CloseHandle (comport);
- fatal(MYNAME ": set timeouts");
+ fatal(MYNAME ": set timeouts\n");
}
}
}
WriteFile (comport, obuf, size, &len, NULL);
if (len != size) {
- fatal(MYNAME ":. Wrote %d of %d bytes.", len, size);
+ fatal(MYNAME ":. Wrote %d of %d bytes.\n", len, size);
}
}
case gt_virtual:
icon_token = mag_find_token_from_descr("Virtual cache");
break;
+ default:
+ break;
}
owpt = global_opts.synthesize_shortnames ?
void *obj = malloc(size);
if (!obj) {
- fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+ fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", size);
}
return obj;
void *obj = calloc(nmemb, size);
if (!obj) {
- fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+ fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", size);
}
return obj;
char *o = strdup(s);
if (!o) {
- fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+ fatal("gpsbabel: Unable to allocate %d bytes of memory.\n", strlen(s));
}
return o;